package com.hc.java.sync;

/**
 * @author cdhuangchao3
 * @date 2023/12/2 3:18 PM
 */
public class 锁重入 {

    static  final  Object obj = new Object();
    public static void method1(){
        synchronized (obj){
            // 同步块
            System.out.println(111);
            method2();
        }
    }

    public static void method2(){
        synchronized (obj) {
            System.out.println(222);
        }
    }

    public static void main(String[] args) {
        method1();
    }
}
